package com.videoweb.mapper;

import com.videoweb.entity.User;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Mapper;

import java.util.List;

/**
 * <p>
 *  Mapper 接口
 * </p>
 *
 * @author lmr
 * @since 2025-05-17
 */
@Mapper
public interface UserMapper extends BaseMapper<User> {

    public List<User> selectAllUser();

    public User findUserByUserName(String username);

    // 查询用户已分配角色
    List<Long> selectRoleIdsByUserId(Long userId);

    // 删除用户所有角色
    void deleteUserRoles(Long userId);

    // 批量插入用户角色
    void insertUserRoles(Long userId, List<Integer> roleIds);

    // 删除用户单个角色
    int deleteUserRole(Long userId, Long roleId);
}
